	var questionModel = {};
	var questions = [];
	var answers = [];
	var options = [];
	var confirmNum = 0;

function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}
function edit(){
  
  $.ajax({  
    url:"/smallQuestion/api/getAllQuestion?titleId="+GetQueryString("titleId"),  
    type:"get",  
    dataType:"json",  
    contentType : 'application/json',
    success:function(qm){  
    	questionModel.answers = qm.answers;
    	questionModel.options = qm.options;
    	questionModel.questions = qm.questions;
      if(qm != null && qm.questions.length > 0){
        var grade = 0;
    	  for (var i = 0; i < qm.questions.length; i++) {
    	        // debugger
    	        var index = 0; //选择添加问题的类型
    	        grade  = (i+1);
    	        var movie_box = '<div class="movie_box" style="border: 1px solid rgb(255, 255, 255);"></div>';
//    	        var Grade = $(".yd_box").find(".movie_box").length + 1;
//    	        alert(Grade);
    	        var wjdc_list = '<ul class="wjdc_list"></ul>'; //问答 单选 多选
    	        var danxuan = "";
    	        var showQuestion = "请编辑问题!";
    	        danxuan = '【单选】';
    	        showQuestion = qm.questions[i].qName;
    	        var wl = "";
    	        wl = wl+' <div style="display:none" class="questionId">'+qm.questions[i].id+'</div><li><div class="tm_btitlt"><i class="nmb">' + qm.questions[i].aNum + '</i>. <i class="btwenzi"><b>'+showQuestion+'</b></i></div></li>';
    	        for (var j = 0; j < qm.options.length; j++) {
    	          if(qm.questions[i].aNum == qm.options[j].aNum){
    	            wl = wl+ ' <li><label><span>' + (qm.options[j].oName) + '</span>--跳<h>'+qm.options[j].aToId+'</h></label><div style="display:none" class="optionId" value="'+qm.options[j].id+'">'+qm.options[j].id+'</div></i>';
    	          }
              }
    	        wjdc_list = $(wjdc_list).append(wl);
    	        movie_box = $(movie_box).append(wjdc_list);
    	        movie_box = $(movie_box).append('<div class="dx_box" data-t="' + index + '"></div>');
    	          $(movie_box).hover(function() {
//    	            var html_cz = "<div class='kzqy_czbut'><a href='javascript:void(0)' class='sy'>上移</a><a href='javascript:void(0)'  class='xy'>下移</a><a href='javascript:void(0)'  class='bianji'>编辑</a><a href='javascript:void(0)' class='del' >删除</a></div>"
    	              var html_cz = "<div class='kzqy_czbut'><a href='javascript:void(0)'  class='bianji'>编辑</a><a href='javascript:void(0)' class='del' >删除</a></div>"
    	            $(this).css({
    	                "border": "1px solid #0099ff"
    	            });
    	            $(this).children(".wjdc_list").after(html_cz);
    	        }, function() {
    	            $(this).css({
    	                "border": "1px solid #fff"
    	            });
    	            $(this).children(".kzqy_czbut").remove();
    	            //$(this).children(".dx_box").hide(); 
    	        });
    	        $(".yd_box").append(movie_box);

    	        } 
      }
      
      
      if(qm != null && qm.answers.length > 0){
        for (var i = 0; i < qm.answers.length; i++) {
          grade = grade+1;
              // debugger
              var index = 2; //选择添加问题的类型
              var movie_box = '<div class="movie_box" style="border: 1px solid rgb(255, 255, 255);"></div>';
//              var Grade = $(".yd_box").find(".movie_box").length + 1;
//              alert(Grade);
              var wjdc_list = '<ul class="wjdc_list"></ul>'; //问答 单选 多选
              var danxuan = "";
              var showQuestion = "请编辑问题!";
              danxuan = '【答案】';
              showQuestion = qm.answers[i].aTitle;
              var wl = "";
              wl = wl+' <div style="display:none" class="answersId">'+qm.answers[i].id+'</div><li><div class="tm_btitlt"><i class="nmb">' + qm.answers[i].aNum + '</i>. <i class="btwenzi"><b>'+showQuestion+'</b></i></div></li>';
              wl = wl+ ' <li><label><textarea name="" cols="" rows="" class="input_wenbk btwen_text btwen_text_dx" placeholder="此处填写答案内容" ></textarea></label></i>';
              wjdc_list = $(wjdc_list).append(wl);
              $(wjdc_list).find("textarea").val(qm.answers[i].aInfo);
              movie_box = $(movie_box).append(wjdc_list);
              movie_box = $(movie_box).append('<div class="dx_box" data-t="' + index + '"></div>');
                $(movie_box).hover(function() {
//                  var html_cz = "<div class='kzqy_czbut'><a href='javascript:void(0)' class='sy'>上移</a><a href='javascript:void(0)'  class='xy'>下移</a><a href='javascript:void(0)'  class='bianji'>编辑</a><a href='javascript:void(0)' class='del' >删除</a></div>"
                  var html_cz = "<div class='kzqy_czbut'><a href='javascript:void(0)'  class='bianji'>编辑</a><a href='javascript:void(0)' class='del' >删除</a></div>"
                  $(this).css({
                      "border": "1px solid #0099ff"
                  });
                  $(this).children(".wjdc_list").after(html_cz);
              }, function() {
                  $(this).css({
                      "border": "1px solid #fff"
                  });
                  $(this).children(".kzqy_czbut").remove();
                  //$(this).children(".dx_box").hide(); 
              });
              $(".yd_box").append(movie_box);

              } 
      }
      
      
//        wjdc_list = $(wjdc_list).append('<li>  <label> <textarea name="" cols="" rows="" class="input_wenbk btwen_text btwen_text_dx" placeholder="此处填写答案内容" ></textarea></label> </li>');
    
    }  
});
  
   
  }

function addquerstions(index){
	 // debugger
//   var index = "0"; //选择添加问题的类型
//   if (index == "-1") {
//       return;
//   }
   var movie_box = '<div class="movie_box" style="border: 1px solid rgb(255, 255, 255);"></div>';
   var Grade = $(".yd_box").find(".movie_box").length + 1;
   switch (index) {
       case "0": 
       case "1": //多选
       case "2": //问答
       //单选
         var wjdc_list = '<ul class="wjdc_list"></ul>'; //问答 单选 多选
         var danxuan = "";
         var showQuestion = "";
         if (index == "0") {
             danxuan = '【单选】';
             showQuestion = "请编辑问题!";
       
         } else if (index == "1") {
             danxuan = '【多选】';
         } else if (index == "2") {
             danxuan = '【问答】';
             showQuestion = "请编辑答案！";
         }
         
         wjdc_list = $(wjdc_list).append(' <li><div class="tm_btitlt"><i class="nmb">' + Grade + '</i>. <i class="btwenzi"><b>'+showQuestion+'</b></i></div></li>');
         if (index == "2") {
             wjdc_list = $(wjdc_list).append('<li>  <label> <textarea name="" cols="" rows="" class="input_wenbk btwen_text btwen_text_dx" placeholder="此处填写答案内容" ></textarea></label> </li>');
         }
         movie_box = $(movie_box).append(wjdc_list);
         movie_box = $(movie_box).append('<div class="dx_box" data-t="' + index + '"></div>');

         break;
       case "3":
           var wjdc_list = ' <div class="wjdc_list"><h4 class="title_wjht"><i class="nmb">' + Grade + '</i>. 请编辑问题!<span class="tip_wz">【矩阵】</span></h4>'
           +' <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tswjdc_table"><tbody></tbody></table></div>'; //问答 单选 多选

           movie_box = $(movie_box).append(wjdc_list);
           movie_box = $(movie_box).append('<div class="dx_box" data-t="' + index + '"></div>');
           break;

   }



   $(movie_box).hover(function() {
//       var html_cz = "<div class='kzqy_czbut'><a href='javascript:void(0)' class='sy'>上移</a><a href='javascript:void(0)'  class='xy'>下移</a><a href='javascript:void(0)'  class='bianji'>编辑</a><a href='javascript:void(0)' class='del' >删除</a></div>"
         var html_cz = "<div class='kzqy_czbut'><a href='javascript:void(0)'  class='bianji'>编辑</a><a href='javascript:void(0)' class='del' >删除</a></div>"
       $(this).css({
           "border": "1px solid #0099ff"
       });
       $(this).children(".wjdc_list").after(html_cz);
   }, function() {
       $(this).css({
           "border": "1px solid #fff"
       });
       $(this).children(".kzqy_czbut").remove();
       //$(this).children(".dx_box").hide(); 
   });
   $(".yd_box").append(movie_box);
	
}


$(document).ready(function(e) {
	

	edit();
	
$(".q_save_but").click(function(){
	questionModel.sTitleId = GetQueryString("titleId");
		console.log("保存：");
		console.log(questionModel.options);
		var isSave = true;
		for (var k = questionModel.options.length-1;k >= 0;k--) {
		  var ival = parseInt(questionModel.options[k].aToId);//如果变量val是字符类型的数则转换为int类型 如果不是则ival为NaN
	    if(isNaN(ival)){
	      isSave = false;
	      alert("保存失败！请检查题目跳转题号是否对应数字！");
	    }
		}
		if(isSave){
		  
		  $.ajax({  
		    url:"/smallQuestion/api/saveAll",  
		    type:"POST",  
		    dataType:"json",  
		    contentType : 'application/json',
		    data:JSON.stringify(questionModel),  
		    success:function(r){  
		      alert("保存成功！");
		    }  
		  });  
		  
		}
		
	})


			
			
			/*	$(".btwen_text").val("题目");
				$(".btwen_text_dx").val("单选题目");
				$(".btwen_text_duox").val("多选题目");
				$(".btwen_text_tk").val("填空题目");

				$(".leftbtwen_text").val("例子：CCTV1，CCTV2，CCTV3");
				$(".xxk_title li").click(function() {
					var xxkjs = $(this).index();
					$(this).addClass("on").siblings().removeClass("on");
					$(".xxk_conn").children(".xxk_xzqh_box").eq(xxkjs).show().siblings().hide();
				});*/

				//鼠标移上去显示按钮
				$(".movie_box").hover(function() {
//					var html_cz = "<div class='kzqy_czbut'><a href='javascript:void(0)' class='sy'>上移</a><a href='javascript:void(0)'  class='xy'>下移</a><a href='javascript:void(0)'  class='bianji'>编辑</a><a href='javascript:void(0)' class='del' >删除</a></div>"
					  var html_cz = "<div class='kzqy_czbut'><a href='javascript:void(0)'  class='bianji'>编辑</a><a href='javascript:void(0)' class='del' >删除</a></div>"
					$(this).css({
						"border": "1px solid #0099ff"
					});
					$(this).children(".wjdc_list").after(html_cz);
				}, function() {
					$(this).css({
						"border": "1px solid #fff"
					});
					$(this).children(".kzqy_czbut").remove();
					//$(this).children(".dx_box").hide(); 
				});

				//下移
				$(".xy").live("click", function() {
					//文字的长度 
					var leng = $(".yd_box").children(".movie_box").length;
					var dqgs = $(this).parent(".kzqy_czbut").parent(".movie_box").index();

					if(dqgs < leng - 1) {
						var czxx = $(this).parent(".kzqy_czbut").parent(".movie_box");
						var xyghtml = czxx.next().html();
						var syghtml = czxx.html();
						czxx.next().html(syghtml);
						czxx.html(xyghtml);
						//序号
						czxx.children(".wjdc_list").find(".nmb").text(dqgs + 1);
						czxx.next().children(".wjdc_list").find(".nmb").text(dqgs + 2);
					} else {
						alert("到底了");
					}
				});
				//上移
				$(".sy").live("click", function() {
					//文字的长度 
					var leng = $(".yd_box").children(".movie_box").length;
					var dqgs = $(this).parent(".kzqy_czbut").parent(".movie_box").index();
					if(dqgs > 0) {
						var czxx = $(this).parent(".kzqy_czbut").parent(".movie_box");
						var xyghtml = czxx.prev().html();
						var syghtml = czxx.html();
						czxx.prev().html(syghtml);
						czxx.html(xyghtml);
						//序号
						czxx.children(".wjdc_list").find(".nmb").text(dqgs + 1);
						czxx.prev().children(".wjdc_list").find(".nmb").text(dqgs);

					} else {
						alert("到头了");
					}
				});
				//删除
				$(".del").live("click", function() {
					var czxx = $(this).parent(".kzqy_czbut").parent(".movie_box");
					
	         //接受编辑内容的容器
		          var dx_rq = $(this).parent(".kzqy_czbut").parent(".movie_box").find(".dx_box");
		          var title = dx_rq.attr("data-t");
		          if(title == 0){
		            var questionId = czxx.find(".questionId").text();
		            
		            for (var i = 0; i < questionModel.questions.length; i++) {
		              if(questionId == questionModel.questions[i].id){
		            	  
		            	  for (var k = questionModel.options.length-1;k >= 0;k--) {
					            if(questionModel.questions[i].aNum == questionModel.options[k].aNum){
					              if(questionModel.options[k].id != ""){
					                $.ajax({  
					                  url:"/smallQuestion/api/delOption?id="+questionModel.options[k].id,  
					                  type:"GET",  
					                  dataType:"json",  
					                  contentType : 'application/json',
					//                data:JSON.stringify(questionModel),  
					                  success:function(r){  
					                	  questionModel.options.splice(k,1);
					//                  alert("保存成功！");
					                  }  
					                });
					                
					              }
					            }
			          }
		            	  
		                questionModel.questions.splice(i,1);
		                if(questionId != ""){
		                  $.ajax({  
		                    url:"/smallQuestion/api/delQuestion?id="+questionId,  
		                    type:"GET",  
		                    dataType:"json",  
		                    contentType : 'application/json',
		                    success:function(r){  
		                    }  
		                  });
		                  
		                }
		              }
		            }
		        
		          }
		          if(title == 2){
		            var answerId = czxx.find(".answersId").text();
		            for (var i = 0; i < questionModel.answers.length; i++) {
		              if(answerId == questionModel.answers[i].id){
		                questionModel.answers.splice(i,1);
		                if(answerId != ""){
		                  $.ajax({  
		                    url:"/smallQuestion/api/delAnswer?id="+answerId,  
		                    type:"GET",  
		                    dataType:"json",  
		                    contentType : 'application/json',
		                    success:function(r){  
		                    }  
		                  });
		                  
		                }
		              }
		            }
		    
		          }
					
					var zgtitle_gs = czxx.parent(".yd_box").find(".movie_box").length;
					var xh_num = zgtitle_gs;
					//重新编号
					czxx.parent(".yd_box").find(".movie_box").each(function() {
						$(".yd_box").children(".movie_box").eq(xh_num).find(".nmb").text(xh_num);
						xh_num++;
					});
					czxx.remove();
				});

				//编辑
				$(".bianji").live("click", function() {
					//编辑的时候禁止其他操作   
					$(this).siblings().hide();
					//$(this).parent(".kzqy_czbut").parent(".movie_box").unbind("hover"); 
					var dxtm = $(".dxuan").html();
					var duoxtm = $(".duoxuan").html();
					var tktm = $(".tktm").html();
					var jztm = $(".jztm").html();
					//接受编辑内容的容器
					var dx_rq = $(this).parent(".kzqy_czbut").parent(".movie_box").find(".dx_box");
					var title = dx_rq.attr("data-t");
					
					//alert(title);
					//题目选项的个数
					var timlrxm = $(this).parent(".kzqy_czbut").parent(".movie_box").children(".wjdc_list").children("li").length;

					//单选题目
					if(title == 0) {
						dx_rq.show().html(dxtm);
						//模具题目选项的个数
						var bjxm_length = dx_rq.find(".title_itram").children(".kzjxx_iteam").length;
						var dxtxx_html = dx_rq.find(".title_itram").children(".kzjxx_iteam").html();
						//添加选项题目
						for(var i_tmxx = bjxm_length; i_tmxx < timlrxm - 1; i_tmxx++) {
							dx_rq.find(".title_itram").append("<div class='kzjxx_iteam'>" + dxtxx_html + "</div>");
						}
						//赋值文本框 
						//题目标题
						var texte_bt_val = $(this).parent(".kzqy_czbut").parent(".movie_box").find(".wjdc_list").children("li").eq(0).find(".tm_btitlt").children(".btwenzi").children("b").text();
//						dx_rq.find(".btwen_text").val(texte_bt_val);
						//遍历题目项目的文字
						var bjjs = 0;
						var title_val = $(this).parent(".kzqy_czbut").parent(".movie_box").find(".wjdc_list").children("li").eq(0).find("b").text();
						dx_rq.find(".btwen_text_dx").val(title_val);
						$(this).parent(".kzqy_czbut").parent(".movie_box").find(".wjdc_list").children("li").each(function() {
							//可选框框
							var ktksfcz = $(this).find("input").hasClass("wenb_input");
							if(ktksfcz) {
								var jsxz_kk = $(this).index();
								dx_rq.find(".title_itram").children(".kzjxx_iteam").eq(jsxz_kk - 1).find("label").remove();
							}
							//题目选项
							var texte_val = $(this).find("span").text();
							var jump_val = $(this).find("h").text();
							var option_val = $(this).find(".optionId").text();
//							var title_val = $(this).find("h3").text();
							dx_rq.find(".title_itram").children(".kzjxx_iteam").eq(bjjs - 1).find(".input_wenbk").val(texte_val);
							dx_rq.find(".title_itram").children(".kzjxx_iteam").eq(bjjs - 1).find(".input_jump").val(jump_val);
							dx_rq.find(".title_itram").children(".kzjxx_iteam").eq(bjjs - 1).find(".option_id").val(option_val);
//							dx_rq.find(".btwen_text_dx").val(title_val);
							bjjs++

						});
					}
					//多选题目  
					if(title == 1) {
						dx_rq.show().html(duoxtm);
						//模具题目选项的个数
						var bjxm_length = dx_rq.find(".title_itram").children(".kzjxx_iteam").length;
						var dxtxx_html = dx_rq.find(".title_itram").children(".kzjxx_iteam").html();
						//添加选项题目
						for(var i_tmxx = bjxm_length; i_tmxx < timlrxm - 1; i_tmxx++) {
							dx_rq.find(".title_itram").append("<div class='kzjxx_iteam'>" + dxtxx_html + "</div>");
							//alert(i_tmxx);
						}
						//赋值文本框 
						//题目标题
						var texte_bt_val = $(this).parent(".kzqy_czbut").parent(".movie_box").find(".wjdc_list").children("li").eq(0).find(".tm_btitlt").children(".btwenzi").children("b").text();
//						dx_rq.find(".btwen_text").val(texte_bt_val);
						//遍历题目项目的文字
						var bjjs = 0;
						$(this).parent(".kzqy_czbut").parent(".movie_box").find(".wjdc_list").children("li").each(function() {
							//可选框框
							var ktksfcz = $(this).find("input").hasClass("wenb_input");
							if(ktksfcz) {
								var jsxz_kk = $(this).index();
								dx_rq.find(".title_itram").children(".kzjxx_iteam").eq(jsxz_kk - 1).find("label").remove();
							}
							//题目选项
							var texte_val = $(this).find("span").text();
							dx_rq.find(".title_itram").children(".kzjxx_iteam").eq(bjjs - 1).find(".input_wenbk").val(texte_val);
							bjjs++

						});
					}
					//填空题目
					if(title == 2) {
						dx_rq.show().html(tktm);
						//赋值文本框 
						//题目标题
						var texte_bt_val = $(this).parent(".kzqy_czbut").parent(".movie_box").find(".wjdc_list").children("li").eq(0).find(".tm_btitlt").children(".btwenzi").children("b").text();
						dx_rq.find(".btwen_text").val(texte_bt_val);
					}
					//矩阵题目
					if(title == 3) {
						dx_rq.show().html(jztm);
					}
				});

				//增加选项  
				$(".zjxx").live("click", function() {
					var zjxx_html = $(this).prev(".title_itram").children(".kzjxx_iteam").html();
					$(this).prev(".title_itram").append("<div class='kzjxx_iteam'>" + zjxx_html + "</div>");
				});

				//删除一行 
				$(".del_xm").live("click", function() {
				  var optionId = $(this).parent(".kzjxx_iteam").find(".option_id").val();
				  for (var i = 0; i < questionModel.options.length; i++) {
		            if(optionId == questionModel.options[i].id){
		              questionModel.options.splice(i,1);
		              if(optionId != ""){
		                $.ajax({  
		                  url:"/smallQuestion/api/delOption?id="+optionId,  
		                  type:"GET",  
		                  dataType:"json",  
		                  contentType : 'application/json',
		//                data:JSON.stringify(questionModel),  
		                  success:function(r){  
		//                  alert("保存成功！");
		                  }  
		                });
		                
		              }
		            }
          }
					//获取编辑题目的个数
					var zuxxs_num = $(this).parent(".kzjxx_iteam").parent(".title_itram").children(".kzjxx_iteam").length;
					if(zuxxs_num > 1) {
						$(this).parent(".kzjxx_iteam").remove();
					} else {
						alert("手下留情");
					}
				});
				//取消编辑
				$(".dx_box .qxbj_but").live("click", function() {
					$(this).parent(".bjqxwc_box").parent(".dx_box").empty().hide();
					$(".movie_box").css({
						"border": "1px solid #fff"
					});
					$(".kzqy_czbut").remove();
					//            
				});
				// body...
				//完成编辑（编辑）
				$(".swcbj_but").live("click", function() {

					var jcxxxx = $(this).parent(".bjqxwc_box").parent(".dx_box"); //编辑题目区
					var querstionType = jcxxxx.attr("data-t"); //获取题目类型
					var questionId = $(this).parent(".bjqxwc_box").parent(".dx_box").parent(".movie_box").find(".questionId").text();
					
					switch(querstionType) {
						case "0": //单选
						case "1": //多选	
						  console.log("保存数据：");
						  console.log(questionModel);
							//编辑题目选项的个数
							var bjtm_xm_length = jcxxxx.find(".title_itram").children(".kzjxx_iteam").length; //编辑选项的 选项个数
							var xmtit_length = jcxxxx.parent(".movie_box").children(".wjdc_list").children("li").length - 1; //题目选择的个数

							//赋值文本框 
							//题目标题
							var texte_bt_val_bj = jcxxxx.find(".btwen_text").val(); //获取问题题目
							var nmbText = jcxxxx.parent().find(".nmb").text(); //获取问题题目
							if(questionId == ""){
							  for (var m = questionModel.questions.length-1;m >= 0;m--) {
							    if(nmbText == questionModel.questions[m].aNum){
							      questionModel.questions.splice(m,1);
							    }
							  }
							var question = {};
							  question.sTitleId = GetQueryString("titleId");
							  question.aNum = nmbText;
							  question.qName = texte_bt_val_bj;
//							  questions.push(question);
							  questionModel.questions.push(question);
							  
							}else{
						       for (var i = 0; i < questionModel.questions.length; i++) {
				                   if(questionId == questionModel.questions[i].id){
				                     questionModel.questions[i].id = questionId
				                     questionModel.questions[i].qName = texte_bt_val_bj
				                     questionModel.questions[i].sTitleId = GetQueryString("titleId");
				                     questionModel.questions[i].aNum = nmbText;
				                   }
				                 }
							}
							
							jcxxxx.parent(".movie_box").children(".wjdc_list").children("li").eq(0).find(".tm_btitlt").children(".btwenzi").children("b").text(texte_bt_val_bj); //将修改过的问题题目展示

							//删除选项
							for(var toljs = xmtit_length; toljs > 0; toljs--) {
								jcxxxx.parent(".movie_box").children(".wjdc_list").children("li").eq(toljs).remove();
							}
							//遍历题目项目的文字
							
					    for (var k = questionModel.options.length-1;k >= 0;k--) {
                if(nmbText == questionModel.options[k].aNum && questionModel.options[k].id != ""){
                  questionModel.options.splice(k,1);
                }
               }
							
							var bjjs_bj = 0;
							jcxxxx.children(".title_itram").children(".kzjxx_iteam").each(function(n) {
								//题目选项
								var texte_val_bj = $(this).find(".input_wenbk").val(); //获取填写信息
								var input_jump_val = $(this).find(".input_jump").val(); //获取跳转题号
								var optionId = $(this).find(".option_id").val();
								console.log("optionId:"+optionId);
								console.log(questionModel.options);
								if(optionId == ""){
								  var option = {};
								  
								  option.aToId = input_jump_val;
	                option.oName = texte_val_bj;
	                option.sTitleId = GetQueryString("titleId");
	                option.aNum = nmbText;
	                questionModel.options.push(option);
								}else{
								  for (var i = 0; i < questionModel.options.length; i++) {
								    if(optionId == questionModel.options[i].id){
								      questionModel.options[i].id = optionId;
								      questionModel.options[i].aToId = input_jump_val;
								      questionModel.options[i].oName = texte_val_bj;
								      questionModel.options[i].sTitleId = GetQueryString("titleId");
								      questionModel.options[i].aNum = nmbText;
								    }
								  }
								}
								console.log(questionModel.options);
								
								var inputType = 'radio';
								//jcxxxx.parent(".movie_box").children(".wjdc_list").children("li").eq(bjjs_bj + 1).find("span").text(texte_val_bj);
								if(querstionType == "1") {
									inputType = 'checkbox';
								}
//								var li = '<li><label><input name="a" type="' + inputType + '" value=""><span>' + texte_val_bj + '</span></label></li>';
								var li = '<li><label><span>' + texte_val_bj + '</span>--跳<h>'+input_jump_val+'</h></label><div style="display:none" class="optionId" value="'+optionId+'">'+optionId+'</div></li>';
								jcxxxx.parent(".movie_box").children(".wjdc_list").append(li);

								bjjs_bj++
								//可填空  
								var kxtk_yf = $(this).find(".fxk").is(':checked');
								if(kxtk_yf) {
									//第几个被勾选
									var jsxz = $(this).index();
									//alert(jsxz);
									jcxxxx.parent(".movie_box").children(".wjdc_list").children("li").eq(jsxz + 1).find("span").after("<input name='' type='text' class='wenb_input'>");
								}
								
							});
							
//							questionModel.options = options;

							break;
						case "2":
							var texte_bt_val_bj = jcxxxx.find(".btwen_text").val(); //获取问题题目
							var nmbText = jcxxxx.parent().find(".nmb").text(); //获取问题题目
							var info = jcxxxx.parent().find(".input_wenbk").val(); //获取问题题目
							var answerId = $(this).parent(".bjqxwc_box").parent(".dx_box").parent(".movie_box").find(".answersId").text();
							
							var answer = {};
							if(answerId == ""){
							  
	               for (var d = questionModel.answers.length-1;d >= 0;d--) {
	                  if(nmbText == questionModel.answers[d].aNum){
	                    questionModel.answers.splice(d,1);
	                  }
	                }
							  
                answer.aTitle = texte_bt_val_bj;
	              answer.aInfo = info;
	              answer.aNum = nmbText;
	              answer.sTitleId = GetQueryString("titleId");
              questionModel.answers.push(answer);
						}else{
                
			                for (var i = 0; i < questionModel.answers.length; i++) {
			                  if(answerId == questionModel.answers[i].id){
			                    questionModel.answers[i].id = answerId;
			                    questionModel.answers[i].aTitle = texte_bt_val_bj;
			                    questionModel.answers[i].aInfo = info;
			                    questionModel.answers[i].sTitleId = GetQueryString("titleId");
			                    questionModel.answers[i].aNum = nmbText;
			                  }
			                }
			              }
							
							
							jcxxxx.parent(".movie_box").children(".wjdc_list").children("li").eq(0).find(".tm_btitlt").children(".btwenzi").children("b").text(texte_bt_val_bj); //将修改过的问题题目展示
							break;

						case "3": //矩阵
							jcxxxx.parent(".movie_box").children(".wjdc_list").children("table").children("tbody").empty();
							var querstionType = jcxxxx.find(".xzqk:checked").val();
							console.log(querstionType);
							var title = jcxxxx.find("textarea.input_wenbk.btwen_text").val(); //获取标题
							var x_iteam = new Array(); //获取 横向选项	
							var y_iteam = " ," + jcxxxx.find(".leftbtwen_text").val(); //左标题
							jcxxxx.find(".title_itram").children("div.kzjxx_iteam").each(function() {
								var texte_val_bj = $(this).find(".input_wenbk").val(); //获取填写信息
								var checkbox = $(this).find("input.fxk").is(':checked'); //是否可填空
								x_iteam.push({
									name: texte_val_bj,
									checkbox: checkbox
								});

							});
							var y_iteams = y_iteam.split(",");
							for(var item in y_iteams) { //行
								var tr = '<tr>',
									td = '';
								td += '<td>' + y_iteams[item] + '</td>';
								for(var i = 0; i < x_iteam.length; i++) { //列
									if(item != 0) {
										if(x_iteam[i].checkbox) {
											//可填空  
											td += '<td><input name="c1" type="text" value=""></td>';

										} else {
											var inputType = 'radio';
											if(querstionType == "1") {
												inputType = 'checkbox';
											}
											td += '<td><input name="c1" type="' + inputType + '" value=""> </td>';
										}
									} else {
										td += '<td>' + x_iteam[i].name + '</td>';
									}
								}
								jcxxxx.parent(".movie_box").children(".wjdc_list").children("table").children("tbody").append(tr + td);
							}
							break;
					}
					
					questionModel.answers = answers;
					//清除     
					$(this).parent(".bjqxwc_box").parent(".dx_box").empty().hide();
				});
			});
		
		